package com.hans.scala.collection

import scala.collection.mutable

/**
 * map
 * Created by Hans on 2014/4/9.
 */
object MapExample {
  def main(args: Array[String]) {
    val capital = MapMaker.makeMap

    val capital2 = new mutable.HashMap[String, String]() with mutable.SynchronizedMap[String, String] {
      override def default(key: String) = {
        "Why do you want to know?"
      }
    }
    val synSet = new mutable.HashSet[Int] with mutable.SynchronizedSet[Int]

  }
}


object MapMaker {
  def makeMap: mutable.Map[String, String] = {
    new mutable.HashMap[String, String]() with mutable.SynchronizedMap[String, String] {
      override def default(key: String) = {
        "Why do you want to know?"
      }
    }
  }
}
